| Total Complexity | 5 |
| Total Lines | 44 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | /** |
||
| 23 | export default class Select { |
||
| 24 | constructor() { |
||
| 25 | /** |
||
| 26 | * Initiate select with search |
||
| 27 | */ |
||
| 28 | this.selectWithSearch(); |
||
| 29 | |||
| 30 | /** |
||
| 31 | * Initiate select insertable search |
||
| 32 | */ |
||
| 33 | this.selectInsertableSearch(); |
||
| 34 | |||
| 35 | /** |
||
| 36 | * Initiate select dropdown |
||
| 37 | */ |
||
| 38 | this.selectDropdown(); |
||
| 39 | } |
||
| 40 | |||
| 41 | selectWithSearch() { |
||
| 42 | $(".select-with-search").select2(); |
||
| 43 | } |
||
| 44 | |||
| 45 | selectInsertableSearch() { |
||
| 46 | $('.select-insertable-search').selectize({ |
||
| 47 | create: true, |
||
| 48 | sortField: 'text' |
||
| 49 | }); |
||
| 50 | |||
| 51 | $('.select-with-tags').selectize({ |
||
| 52 | delimiter: ',', |
||
| 53 | persist: false, |
||
| 54 | create: function (input) { |
||
| 55 | return { |
||
| 56 | value: input, |
||
| 57 | text: input |
||
| 58 | } |
||
| 59 | } |
||
| 60 | }); |
||
| 61 | } |
||
| 62 | |||
| 63 | selectDropdown() { |
||
| 64 | $('.select-dropdown').selectpicker(); |
||
| 65 | } |
||
| 66 | } |